<?php

  require("../config.php");
  
  if(isset($_GET["id"])) { $id = addentities($_GET["id"]); } else { $id = 0; }
  
//// Retrage informatiile despre jucator din baza de date.  
  $rez_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
  
  if($rez_user["data_nasterii"]!="0000-00-00") { 
  list($anul, $luna, $ziua) = explode("-",$rez_user["data_nasterii"]);
  $varsta = date('Y', time()) - date('Y',mktime('0','0','0',$luna,$ziua,$anul));
  } else { $varsta = 0; }
  
  $nr_planete = mysql_num_rows(mysql_query("SELECT `id` FROM `planete` WHERE `user` = '".$rez_user["user"]."'"));
    
  echo '<div align="right">
	<a href="javascript:void(0)" onMouseUp="javascript:ascunde_element(\'fereastraDrag\');" onMouseOver="javascript:animatie_but2(\'but_inchidere\', 1,\'but_inchidere\')" onMouseOut="javascript:animatie_but2(\'but_inchidere\', 0,\'but_inchidere\')" onMouseDown="javascript:animatie_but2(\'but_inchidere\', 2,\'but_inchidere\')"><img id="but_inchidere" src="img/but_inchidere.gif" alt="optiuni_inchidere" border="0" align="absmiddle" /></a>
	</div>';

//// Afiseaza descrierea utilizatorului.  
  echo '<table border="0" cellspacing="0" cellpadding="0">
  		  <tr>
		    <td width="75" height="75">
			  <img src="avatare/'.$rez_user["avatar"].'" width="75" height="75" border="0" style="border: 1px #FFFFFF dashed">
			</td>
			<td width="300" height="75" class="font_2" style="padding-left: 10px" valign="top" style="line-height: 18px;">
			  <label style="line-height: 17px;"><strong>Nume:</strong> '.$rez_user["prenume"].' '.$rez_user["nume"];
  echo '      </label><br><label style="line-height: 17px;"><strong>Nume utilizator:</strong> '.$rez_user["user"].'</label><br><label style="line-height: 17px;">
			  '; 
  // Verifica daca si-a declarat varsta
  if($varsta != 0) { echo '<strong>Varsta</strong>: '.$varsta.''; } else { echo 'Varsta nedeclarata.'; }
    
  echo '</label>
  		<br><label style="line-height: 17px;"><strong>Sexul:</strong> '.$rez_user["sex"].'</label>
  		</td>
		  </tr>
		  <tr><td colspan="2" height="5"></td></tr>
		  <tr>
		    <td colspan="2" class="font_2" style="padding: 5px; text-align: justify; text-indent: 10px;">
			 <label style="line-height: 17px;">Utilizatorul are';
			 
  // Verifica cate planete are pentru a stii modul de afisare.
  if($nr_planete == 1) { echo ' o planeta, '; } else { echo $nr_planete.' planete, '; }
    echo 'cu un total de '.$rez_user["populatie"].' locuitori.</label></td></tr><tr><td colspan="2" class="font_2" style="padding: 5px; text-align: justify; text-indent: 10px;">';	 
  // Verifica daca face parte din vreo alianta, sau nu.
  if($rez_user["alianta"]!="") { echo $rez_user["user"]." apartine de alianta ".$rez_user["alianta"].'.'; } else { echo $rez_user["user"].' nu apartine niciunei aliante.'; }
  echo '	</td></tr><tr><td colspan="2" class="font_2" style="padding: 5px; text-align: justify; text-indent: 10px;"><label style="line-height: 17px;"><strong>Descriere:</strong><br>&nbsp;&nbsp;&nbsp;&nbsp;';
  if($rez_user["descriere"] != "") { echo $rez_user["descriere"]; } else { echo 'Jucatorul nu are inca o descriere!'; }
  echo '	</label></td>
		  </tr>
		  <tr>
		    <td colspan="2" class="font_2" style="padding: 5px; text-align: justify; text-indent: 10px;"><strong>URL:</strong> '.$rez_user["url"].'</td>
		  </tr>
		  <tr>
		    <td colspan="2" class="font_2" style="padding: 5px"><a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'compune2\', \''.$rez_user["user"].'\');" onMouseOver="javascript:animatie_but(\'but_mesaje_compune\', 1,\'buton_mare\')" onMouseOut="javascript:animatie_but(\'but_mesaje_compune\', 0,\'buton_mare\')" onMouseDown="javascript:animatie_but(\'but_mesaje_compune\', 2,\'buton_mare\')"><div id="but_mesaje_compune" class="butoane_2" style="margin-left:3px; float:right">Trimite mesaj</div></a></td>
		  </tr>
		</table>';
?>